package com.sbtr.controller.classify;

import com.sbtr.common.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.sbtr.exception.BDException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.sbtr.common.PageDto;
import com.sbtr.business.classify.entity.EquipCheck;
import com.sbtr.business.classify.dto.EquipCheckDto;
import com.sbtr.business.classify.service.EquipCheckService;
import org.springframework.web.bind.annotation.RestController;
import com.sbtr.controller.common.CommonController;

/**
 * 设备型号参数 前端控制器
 *
 * @author dgl
 * @since 2023-09-15
 */
@RestController
@RequestMapping("/equipCheck")
@Api(tags = "设备型号参数")
public class EquipCheckController extends CommonController<EquipCheck,EquipCheckService> {

    @GetMapping("/pageList")
    @ApiOperation(httpMethod = "GET", value = "分页列表")
    public Response<PageDto<EquipCheck>> pageList(EquipCheckDto equipCheckDto){
        return Response.success(u.pageList(equipCheckDto));
    }

    @PostMapping("/save")
    @ApiOperation(httpMethod = "POST", value = "保存")
    public Response<EquipCheck> save(@RequestBody EquipCheck equipCheck){
        equipCheck.setId(null);
        if(equipCheck.insert()){
            return Response.success(equipCheck);
        }else throw new BDException("保存失败");
    }

}

